﻿using ERP_RORZE_DLL.Product.Base;
using System;using ERP_RORZE_SYSTEM;
using System.Collections.Generic;
using System.Data;
//using ERP_RORZE_SYSTEM;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using ERP_RORZE_DLL.Product.Base;
using ERP_RORZE_DLL.Product.database;
using System.Data.SqlClient;

namespace ERP_RORZE_DLL.Product.DAO
{
    public class ClsMODAO : ExecuteSQL
    {
        ExecuteSQL Execute = new ExecuteSQL();

        public DataTable GetAllMO()
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetAll;
            return Execute.DoStoreProcedure(sql, true);
        }
        public DataTable GetAllMOStart()
        {
            string sql = clsConstantsFuction.ClsFuctionMO.MOStart;
            return Execute.DoStoreProcedure(sql, true);
        }

        public DataTable GetOptionDataByMONo(ClsOptionDataTable b)
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetOptionDataByMONo;
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsOptionDataSP.PartID, SqlDbType.NVarChar, b.PartID)
                    
                };
            return Execute.DoStoreGetByID(sql,parameter, true);
        }

        public DataTable GetAllMONo(ClsMOTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
           return Execute.DoStoreGetByID(clsConstantsFuction.ClsFuctionMO.GetAllMONo, parameter, true);
        }

        public void InsertMO(ClsMOTable b)
        { 
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOSP.BlastQty, SqlDbType.Int, b.BlastQty),
                    CreateParameter(clsConstantsSP.ClsMOSP.date, SqlDbType.DateTime, b.Date),
                    CreateParameter(clsConstantsSP.ClsMOSP.DeadLine, SqlDbType.DateTime, b.DeadLine),
                    CreateParameter(clsConstantsSP.ClsMOSP.HelisertQty, SqlDbType.Int, b.HelisertQty),
                    CreateParameter(clsConstantsSP.ClsMOSP.Imported, SqlDbType.Bit, b.Imported),
                    CreateParameter(clsConstantsSP.ClsMOSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOSP.MOQty, SqlDbType.Int, b.MOQty),
                    CreateParameter(clsConstantsSP.ClsMOSP.PartID, SqlDbType.NVarChar, b.PartID)
                    
                };
            Execute.DoInsert(clsConstantsFuction.ClsFuctionMO.Insert, parameter, true);

        }
        public void DeleteMO(ClsMOTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoDelete(clsConstantsFuction.ClsFuctionMO.Delete, parameter, true);
        }

        public void UpdateMO(ClsMOTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOSP.BlastQty, SqlDbType.Int, b.BlastQty),
                    CreateParameter(clsConstantsSP.ClsMOSP.date, SqlDbType.DateTime, b.Date),
                    CreateParameter(clsConstantsSP.ClsMOSP.DeadLine, SqlDbType.DateTime, b.DeadLine),
                    CreateParameter(clsConstantsSP.ClsMOSP.Finishdate, SqlDbType.DateTime, b.Finishdate),
                    CreateParameter(clsConstantsSP.ClsMOSP.Finished, SqlDbType.Bit, b.Finished),
                    CreateParameter(clsConstantsSP.ClsMOSP.HelisertQty, SqlDbType.Int, b.HelisertQty),
                    CreateParameter(clsConstantsSP.ClsMOSP.Imported, SqlDbType.Bit, b.Imported),
                    CreateParameter(clsConstantsSP.ClsMOSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOSP.MOQty, SqlDbType.Int, b.MOQty),
                    CreateParameter(clsConstantsSP.ClsMOSP.NGQty, SqlDbType.Int, b.NGQty),
                    CreateParameter(clsConstantsSP.ClsMOSP.Note, SqlDbType.NVarChar, b.Note),
                    CreateParameter(clsConstantsSP.ClsMOSP.OKQty, SqlDbType.Int, b.OKQty),
                    CreateParameter(clsConstantsSP.ClsMOSP.PartID, SqlDbType.NVarChar, b.PartID),
                    CreateParameter(clsConstantsSP.ClsMOSP.startdate, SqlDbType.DateTime, b.Startdate),
                    CreateParameter(clsConstantsSP.ClsMOSP.Started, SqlDbType.Bit, b.Started)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMO.Update, parameter, true);

        }
        public DataTable SelectByMONo(ClsMOTable b)
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetAll;
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            return Execute.DoStoreGetByID(sql, parameter, true);
        }
        public void UpdateBusMONo(ClsBusOderTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsBusOderSP.BOderNo, SqlDbType.NVarChar, b.BOderNo),
                    CreateParameter(clsConstantsSP.ClsBusOderSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsBusOderSP.MOQty, SqlDbType.NVarChar, b.MOQty)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMO.UpdateMONo, parameter, true);
        }

        //MOMaterial
        public DataTable GetAllMOMaterial()
        {
            string sql = clsConstantsFuction.ClsFuctionMOMaterial.GetAll;
            return Execute.DoStoreProcedure(sql, true);
        }
        public void InsertMOMaterial(ClsMOMaterialTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.CutSize, SqlDbType.NVarChar, b.CutSize),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Finishdate, SqlDbType.DateTime, b.Finishdate),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Finished, SqlDbType.Bit, b.Finished),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.lenght, SqlDbType.Float, b.Lenght),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.MaterialID, SqlDbType.NVarChar, b.MaterialID),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.MaterialPrice, SqlDbType.Money, b.MaterialPrice),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.MaterialType, SqlDbType.NVarChar, b.MaterialType),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Note, SqlDbType.NVarChar, b.Note),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.PartID, SqlDbType.NVarChar, b.PartID),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Price, SqlDbType.Money, b.Price),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Shape, SqlDbType.NVarChar, b.Shape),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Thickness, SqlDbType.Float, b.Thickness),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.width, SqlDbType.Float, b.Width)
                    
                };
            Execute.DoInsert(clsConstantsFuction.ClsFuctionMOMaterial.Insert, parameter, true);
        }
        public void UpdateMOMaterial(ClsMOMaterialTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.ID, SqlDbType.Int, b.ID),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.CutSize, SqlDbType.NVarChar, b.CutSize),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Finishdate, SqlDbType.DateTime, b.Finishdate),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Finished, SqlDbType.Bit, b.Finished),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.lenght, SqlDbType.Float, b.Lenght),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.MaterialID, SqlDbType.NVarChar, b.MaterialID),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.MaterialPrice, SqlDbType.Money, b.MaterialPrice),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.MaterialType, SqlDbType.NVarChar, b.MaterialType),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Note, SqlDbType.NVarChar, b.Note),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.PartID, SqlDbType.NVarChar, b.PartID),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Price, SqlDbType.Money, b.Price),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Shape, SqlDbType.NVarChar, b.Shape),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.Thickness, SqlDbType.Float, b.Thickness),
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.width, SqlDbType.Float, b.Width)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMOMaterial.Update, parameter, true);
        }
        public void DeleteMOMaterial(ClsMOMaterialTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.ID, SqlDbType.NVarChar, b.ID)
                    
                };
            Execute.DoDelete(clsConstantsFuction.ClsFuctionMOMaterial.Delete, parameter, true);
        }
        public void MOMaterialAppend(ClsMOMaterialTable b)
        {
            string sql = clsConstantsFuction.ClsFuctionMOMaterial.MOMaterialAppend;
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOMaterialSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoStoreGetByID(sql, parameter, true);
        }

        //MO Option
        public void InsertMOOptionAdd(string MONo, string DK1, string DK2, string DK3, string DK4, string DK5)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter("@MONo", SqlDbType.NVarChar, MONo),
                    CreateParameter("@DK1", SqlDbType.NVarChar, DK1),
                    CreateParameter("@DK2", SqlDbType.NVarChar, DK2),
                    CreateParameter("@DK3", SqlDbType.NVarChar, DK3),
                    CreateParameter("@DK4", SqlDbType.NVarChar, DK4),
                    CreateParameter("@DK5", SqlDbType.NVarChar, DK5)
                    
                };
            Execute.DoInsert(clsConstantsFuction.ClsFuctionMOOption.MOOptionAdd, parameter, true);
        }

        public DataTable GetAllMOOption()
        {
            string sql = clsConstantsFuction.ClsFuctionMOOption.GetAll;
            return Execute.DoStoreProcedure(sql, true);
        }
        //Update MO start
        public void UpDateMOStart(ClsMOTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOSP.startdate, SqlDbType.DateTime, b.Startdate)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMO.UpdateMOStart, parameter, true);
        }

        public void UpDateBusoderMOStart(ClsBusOderTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsBusOderSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMO.UpdateBusoderMOStart, parameter, true);
        }
        //MOQty Status

        public DataTable MOQtyStatus()
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetAllMOQtyStatus;
            return Execute.DoStoreProcedure(sql, true);
        }
        
        //MO Option Status
        public DataTable MOOptionStatus()
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetAllMOOptionStatus;
            return Execute.DoStoreProcedure(sql, true);
        }

        //MOQty Change
        public DataTable GetMOQtyChange()
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetAllMOQtyChange;
            return Execute.DoStoreProcedure(sql, true);
        }

        public void UpdateBOderMOQtyChange(ClsBusOderTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsBusOderSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsBusOderSP.MOQty, SqlDbType.Int, b.MOQty),
                    CreateParameter(clsConstantsSP.ClsBusOderSP.ChangeDate, SqlDbType.DateTime, b.ChangeDate)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionBusOder.UpdateMOQtyChange, parameter, true);
        }

        public void UpdateMONoMOQtyChange(ClsMOTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOSP.MOQty, SqlDbType.Int, b.MOQty)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMO.UpdateMONoMOQtyChange, parameter, true);
        }
        public void UpdateMOOpMOQtyChange(ClsMOOptionTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOOptionSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOOptionSP.MOQty, SqlDbType.Int, b.MOQty)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMOOption.UpdateMOOpMOQtyChange, parameter, true);
        }
        public void UpdateMOOpMOQtyChange2(ClsMOOptionTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOOptionSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOOptionSP.MOQty, SqlDbType.Int, b.MOQty)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMOOption.UpdateMOOpMOQtyChange2, parameter, true);
        }

        //MOFinish
        public DataTable GetMOFinishMONo()
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetAllMONoMOFinish;
            return Execute.DoStoreProcedure(sql, true);
        }

        public void UpdateMOFinish(ClsMOTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOSP.OKQty, SqlDbType.Int, b.OKQty),
                    CreateParameter(clsConstantsSP.ClsMOSP.Finishdate, SqlDbType.DateTime, b.Finishdate),
                    CreateParameter(clsConstantsSP.ClsMOSP.NGQty, SqlDbType.Int, b.NGQty)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMO.UpdateMOFinish, parameter, true);
        }

        public void UpdateAnodQtyChangeMOFinish(clsAnodQtyChangeTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsAnodQtyChangeSP.Mono, SqlDbType.NVarChar, b.Mono)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionAnodQtyChange.UpdateMOFinish, parameter, true);
        }

        public void UpdateDAnodInspMOFinish(ClsDAnodInspTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDAnodInsp.UpdateMOFinish, parameter, true);
        }
        public void UpdateDBusInspMOFinish(ClsDBusInspTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDAnodInsp.UpdateMOFinish, parameter, true);
        }
        public void UpdateDF3StoreMOFinish(ClsDF3StoreTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDF3Store.UpdateMOFinish, parameter, true);
        }
        public void UpdateDHandInspMOFinish(ClsDHandInspTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDHandInsp.UpdateMOFinish, parameter, true);
        }

        public void UpdateBusOrderMOFinish(ClsBusOderTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionBusOder.UpdateMOFinish, parameter, true);
        }

        public void UpdateDInspAnodMOFinish(ClsDInspAnodTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDInspAnod.UpdateMOFinish, parameter, true);
        }
        public void UpdateDInspF3MOFinish(ClsDInspF3Table b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDInspF3.UpdateMOFinish, parameter, true);
        }

        public void UpdateDMachineHandMOFinish(ClsDMachineHandTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDMachineHand.UpdateMOFinish, parameter, true);
        }

        public void UpdateDMBusInspMOFinish(ClsDMBusInspTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDMBusInsp.UpdateMOFinish, parameter, true);
        }

        public void UpdateDMHandInspMOFinish(ClsDMHandInspTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDMHandInsp.UpdateMOFinish, parameter, true);
        }

        public void UpdateDMInspBusMOFinish(ClsDMInspBusTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDMInspBus.UpdateMOFinish, parameter, true);
        }

        public void UpdateDMInspHandMOFinish(ClsDMInspHandTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsDAnodInspSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionDMInspHand.UpdateMOFinish, parameter, true);
        }

        public void UpdateMOOptionMOFinish(ClsMOOptionTable b)
        {
            var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsMOOptionSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsMOOptionSP.Finishdate, SqlDbType.DateTime, b.Finishdate)
                    
                };
            Execute.DoUpdate(clsConstantsFuction.ClsFuctionMOOption.UpdateMOFinish, parameter, true);
        }
        public DataTable GetAllMOVMoFactPartPrice()
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetAllVMoFactPartPrice;
            return Execute.DoStoreProcedure(sql, true);
        }
        public DataTable GetAllNGChek()
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetAllNGCheck;
            return Execute.DoStoreProcedure(sql, true);
        }

        public DataTable GetAllStaffID()
        {
            string sql = clsConstantsFuction.ClsFuctionMO.GetAllStaffID;
            return Execute.DoStoreProcedure(sql, true);
        }

        public DataTable GetAllOptionID(ClsMOOptionTable b)
        {
            var parameter = new SqlParameter[]
                {
                    CreateParameter(clsConstantsSP.ClsMOSP.MONo, SqlDbType.NVarChar, b.MONo)
                    
                };
            string sql = clsConstantsFuction.ClsFuctionMO.GetAllOptionID;
            return Execute.DoStoreGetByID(sql,parameter, true);
        }
        public void InsertNGCheck(ClsNGCheckTable b)
        { 
             var parameter = new SqlParameter[]
            {
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.Date, SqlDbType.NVarChar, b.Date),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.StaffID, SqlDbType.NVarChar, b.StaffID),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.OptionID, SqlDbType.NVarChar, b.OptionID),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.justment, SqlDbType.NVarChar, b.Justment),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.Qty, SqlDbType.NVarChar, b.Qty),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.Note, SqlDbType.NVarChar, b.Note)
                    
                };
             Execute.DoInsert(clsConstantsFuction.ClsFuctionNGCheck.Insert, parameter, true);
        }

        public void UpdateNGCheck(ClsNGCheckTable b)
        {
            var parameter = new SqlParameter[]
            {
                CreateParameter(clsConstantsSP.ClsNGCheckSP.ID, SqlDbType.Int, b.ID),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.Date, SqlDbType.NVarChar, b.Date),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.MONo, SqlDbType.NVarChar, b.MONo),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.StaffID, SqlDbType.NVarChar, b.StaffID),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.OptionID, SqlDbType.NVarChar, b.OptionID),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.justment, SqlDbType.NVarChar, b.Justment),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.Qty, SqlDbType.NVarChar, b.Qty),
                    CreateParameter(clsConstantsSP.ClsNGCheckSP.Note, SqlDbType.NVarChar, b.Note)
                    
                };
            Execute.DoInsert(clsConstantsFuction.ClsFuctionNGCheck.Update, parameter, true);
        }

        public void DeleteNGCheck(ClsNGCheckTable b)
        {
            var parameter = new SqlParameter[]
            {
                CreateParameter(clsConstantsSP.ClsNGCheckSP.ID, SqlDbType.Int, b.ID)
                    
                };
            Execute.DoInsert(clsConstantsFuction.ClsFuctionNGCheck.Delete, parameter, true);
        }

    }
}
